/**
 * Project  : Looker
 * Package  : net.freestu.looker.common
 * File     : Looker.java
 * Author   : solosky < solosky772@qq.com >
 * Date     : Aug 27, 2009
 * Modified : Aug 27, 2009
 * License  : Apache License 2.0 
 */
package net.freestu.looker.common;

import java.util.concurrent.ExecutorService;

import net.freestu.looker.monitor.MonitorScheduler;
import net.freestu.looker.util.Starter;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;

/**
 *  LOOKER全局对象
 *  保存了全局配置
 *  完成系统启动
 */
public class Looker
{
	/**
	 * 全局配置
	 */
	public static Configuration gloalConfig;
	
	/**
	 * 公共线程池
	 */
	public static ExecutorService executors;
	
	/**
	 * 检查器计划器
	 */
	public static MonitorScheduler listMonitorScheduler;
	
	/**
	 * 更新计划器
	 */
	public static MonitorScheduler contentUpdaterScheduler;
	
	/**
	 * 启动器
	 */
	private static Starter starter;
	
	/**
	 * 启动系统
	 * @throws ConfigurationException 
	 */
	public static void start(String configFile) throws ConfigurationException
    {
	    starter = new Starter();
	    starter.start(configFile);
    }
	
	/**
	 * 关闭系统
	 */
	public static void stop()
	{
		starter.stop();
	}

	 /**
	  * 主程序
	  * @param args
	 * @throws ConfigurationException 
	  */
	
	public static void main(String[] args) throws ConfigurationException
	{
		Looker.start(args[0]);
	}

}
